/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

$(document).ready(function(e){
    //this for the menu
    //    $("#homeSubMenu").show("slow").siblings().hide("slow");
    $('.art-hmenu > li > a').removeClass("active");
    $("#evaluateSubjectMenu").addClass("active");
    //    $('.gen-menu-ul > li > a > span').removeClass("sub-menu-highlight");
    //    $(".gen-menu-ul > li > a > #sendRequest").addClass("sub-menu-highlight");
    
    populateContents();
    jQuery("#subjectEvaluationForm").validationEngine();
});
function evaluateSubject(subjectID){
    
//    $("#subjectEvaluationDialog").html("<img src=\"../images/ajax-loader.gif\" />"+subjectID);
//    $("#subjectEvaluationDialog").dialog('open');
//alert(subjectID);
//    $.getJSON("/TCESystem/category/view~active" ,
//        {
//            //                'borrower.borrowerId': borrowerId
//            },
//            function(json) {
//            $("#subjectEvaluationDialog").dialog('open');
//                $("#subjectEvaluationDialog").html(json.categoryList[0].categoryName);
//            }
//            ); 
}
function populateContents(){
    $.ajax({
        type: "POST",
        url: "/TCESystem/category/view~active",
        data: {
                  'subjectScheduleID':$("#subjectScheduleID").val()
        }, // serializes the form's elements.
        success: function(data)
        {
            $("#dataContainer").html("<img src=\"../images/ajax-loader.gif\" />");
            $("#dataContainer").html(data.dataContent);
        }
    });
    
    
}
function getCategoryQuestion(categoryID){
    var questions="";
    $.ajax({
        type: "POST",
        url: "/TCESystem/question/view~active",
        data: {
            'categoryID':categoryID
        }, // serializes the form's elements.
        success: function(dataQuestion)
        {
            for(var qindex=0; qindex < dataQuestion.questionList.length; qindex++){
                questions+="<li>"+dataQuestion.questionList[qindex].questionDescription+"</li>";
                
            }
        }
    });
    alert(questions);
    return questions;
}






//$.ajax({
//        type: "POST",
//        url: "/TCESystem/category/view~active",
//        data: {
//        //            'subjectID':subjectID
//        }, // serializes the form's elements.
//        success: function(data)
//        {
//            $("#dataContainer").html("<img src=\"../images/ajax-loader.gif\" />");
//            var dataContent="";
//            for(var index=0; index < data.categoryList.length; index++){
//                dataContent+="<div class=\"art-post-inner art-article\">"+
//                             "<h2 class=\"art-postheader tce-green-bg tce-white-font tce-clear-margin tce-padding\">"+
//                             data.categoryList[index].categoryName+
//                             "</h2>"+
//                             "<div class=\"art-postcontent tce-margin\">"+
//                             "<ol>";
//                    
//                dataContent+=getCategoryQuestion(data.categoryList[index].categoryID);
//                dataContent+="</ol>"+
//                             "</div>"+
//                             "<div class=\"cleared\"></div>"+
//                             "</div>";
//            }
//            $("#dataContainer").html(dataContent);
//        }
//    });
